<template>
  <div class="app-header">
    <i class="icon-box iconfont makerjiantouarrowhead7" @click="goBack"></i>
    <div class="app-title">
      <span :class="[activeId === 1 ? 'item-active' : '']" @click="changeHeaderId(1)">本地</span>
      <span :class="[activeId === 2 ? 'item-active' : '']" @click="changeHeaderId(2)">云端</span>
    </div>
  </div>
</template>

<script>
export default {
  name: 'AppHeader',
  props: {
    activeId: Number,
  },
  data() {
    return {
      title: this.$route.meta.title,
    };
  },
  methods: {
    goBack() {
      this.$router.go(-1);
    },
    changeHeaderId(d) {
      this.$emit('handleChangeHeader', d);
    },
  },
};
</script>

<style scoped lang="scss">
.app-header {
  width: 100vw;
  height: 6vh;
  background-color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  .icon-box {
    position: absolute;
    left: 10px;
    width: 10vw;
    height: 20px;
    overflow: hidden;
  }
  .iconfont {
    color: #000000;
    font-size: 20px;
    font-weight: bolder;
  }
  .app-title {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 34vw;
    height: 100%;
    span {
      display: inline-block;
      width: 40px;
      text-align: center;
      height: 100%;
      line-height: 6vh;
      font-size: 16px;
      color: #bebdbd;
    }
    .item-active {
      color: #1e1e1e;
      font-size: 18px;
      position: relative;
      font-weight: bolder;
      &::after {
        content: '';
        position: absolute;
        left: 20%;
        bottom: 0;
        width: 60%;
        height: 4px;
        border-radius: 2px;
        background-color: #ff7e00;
      }
    }
  }
}
</style>
